<h1>Your profile</h1>

<% if @user.id == session[:user_id] then %>

<%= error_messages_for :user %>

<% form_for(@user) do |f| %>
  <p>
    <b>Name</b><br />
    <%= f.text_field :name %>
  </p>

  <p>
    <b>Email</b><br />
    <%= f.text_field :email %><BR>
  </p>
	
	<p>
		<%= f.check_box :showmail %>
	Show my e-mail address
	</p>
		<b>Homepage</b><br>
		<%= f.text_field :homepage %>

	<p><b>Your personal page:</b><br> 
		<%= f.text_area :personaltext %>
		

	</p>


  <p>
    <%= f.submit "Update" %>
  </p>
<% end %>

Tags:
<% for tag in @tags %>
    <% if(session[:user_id] == @user.id) then %> <%= link_to  tag.name  , :action => 'show' ,:controller => 'interests' , :tag_id => tag.id , :user_id => @user.id %>  
    <% else %> 
    <%=h tag.name %>
    <% end %> |
<% end %>

<div id = "tagEdit">  
</div>  

<%= link_to_remote 'Add Tag', 
			:url => {:action => "addTagToProfile" , :controller => "interests" ,:id => @user.id}, 	
			:update => 'tagEdit' %>
			
			
<% else %>
		
<p>You're not allowed to edit other users' profile	</p>
		
<% end %>		
			
<%= link_to 'Show', @user %> |
<%= link_to 'Back', users_path %>
